package dev.hxliu.cn.Injectclasssimple;


import dev.hxliu.cn.inject.InjectMethod;
import dev.hxliu.cn.util.UserContext;
import org.jetbrains.annotations.NotNull;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Objects;

//@FeignClient(value = ParkingCloudServiceNameConstants.PLATFORM_SERVICE,contextId = "ParkLotLoaderServiceClient",primary = false)
public interface ParkLotLoaderServiceClient extends ParkLotLoaderService {


//    @GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX + "/insider/merchant/getParkLotIds")
    R<Long[]> getParkLotIds(@RequestParam("merchantId") Long merchantId);

    @Override
    default Long[] merchantInfo(@NotNull Long merchantId){
        return getParkLotIds(merchantId).getData();
    }

    default Long[] inject(){
        return merchantInfo(Objects.requireNonNull(getTenantId()));
    }
     static Long getTenantId() {
         Long userInfoInTokenBO = UserContext.get();
        if (userInfoInTokenBO != null) {
            return userInfoInTokenBO;
        } else {
            return null;
        }
    }
}
